// 获取用户信息
function getUser() {
    const loginBtn = $('.loginBtn')
    const pEle = $('p')
    const usernameInput = $('input[name="username"]')
    const passwordInput = $('input[name="password"]')
    loginBtn.on('click', function () {
        let username = usernameInput.val()
        let password = passwordInput.val()
        $.ajax({
            type: 'POST',
            url: 'http://10.7.171.55:8088/api/login',
            data: {
                username: username,
                password: password,
            },
            success: function (data) {
                if (data.resultCode == -1) {
                    pEle.html(data.resultInfo)
                } else {
                    let user = {
                        headerimg: data.resultInfo.headerimg,
                        nick: data.resultInfo.nick
                    }
                    localStorage.setItem('LOGIN', JSON.stringify(user))
                    location.href = 'index.html'
                }
            }
        })
    })
}
getUser()